package top.readhub.wopei.manager.es;

import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * 基于XContent封装同意操作方法
 * <p>
 * Created by daervin on 2021/6/16
 */
@Component
public class ESClient {
    @Autowired
    private RestHighLevelClient client;

    public void search() throws IOException {
        XContentBuilder builder = XContentFactory.jsonBuilder()
                .startObject()
                .field("xx", "xxx")
                .endObject();
        builder.toString();
//        client.search();
    }
}
